/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.ucase.casemain.controller;

import cn.hutool.core.lang.Dict;
import com.icinfo.cloud.common.core.page.PageResponse;
import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.CaseProsecutionIdDto;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.CaseReconsiderPageQueryRequest;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.CaseReconsiderRegisterSaveDto;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.CaseReconsiderResultSaveDto;
import com.icinfo.cloud.provider.punish.ucase.casemain.service.ICaseReconsiderService;
import com.icinfo.cloud.provider.punish.ucase.casemain.vo.CaseReconsiderRegisterVo;
import com.icinfo.cloud.provider.punish.ucase.casemain.vo.CaseReconsiderVo;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 描述: 案件复议表 控制器
 *
 * @author lilihao
 * @date 2022年12月08日
 */
@RestController
@RefreshScope
@RequestMapping("/punish/ucase/reconsider")
@Slf4j
public class CaseReconsiderController extends BaseController {
    /**
     * 日志记录器
     */
    private static final Logger logger = LoggerFactory.getLogger(CaseReconsiderController.class);

    @Autowired
    private ICaseReconsiderService caseReconsiderService;

    /**
     * 分页获取案件复议列表
     *
     * @param request 请求对象
     * @return 诉讼列表
     * @author lilihao
     * @date 2022/12/2 20:39
     */
    @PostMapping("/getPageList")
    @ApiOperation(value = "【V1.9.3】描述：分页获取案件复议列表", httpMethod = "POST")
    public Result<PageResponse<CaseReconsiderVo>> getPageList(@RequestBody @Validated CaseReconsiderPageQueryRequest request) {
        PageResponse<CaseReconsiderVo> pageList = caseReconsiderService.getPageList(request);
        return Result.success(Constant.STRING_GET_SUCCESS,pageList);
    }

    /**
     * 保存复议登记信息
     *
     * @param registerSaveDto 请求对象
     * @return 复议登记信息
     * @author lilihao
     * @date 2022/12/8 20:39
     */
    @PostMapping("/saveRegisterInfo")
    @ApiOperation(value = "【V1.9.3】描述：保存复议登记信息", httpMethod = "POST")
    public Result saveRegisterInfo(@RequestBody @Validated CaseReconsiderRegisterSaveDto registerSaveDto) {
        caseReconsiderService.saveRegisterInfo(registerSaveDto);
        return Result.success(Constant.STRING_SAVE_SUCCESS);
    }

    /**
     * 获取复议登记信息
     *
     * @param idDto 请求对象
     * @return 复议登记信息
     * @author lilihao
     * @date 2022/12/2 20:39
     */
    @PostMapping("/getRegisterInfo")
    @ApiOperation(value = "【V1.9.3】描述：获取复议登记信息", httpMethod = "POST")
    public Result<CaseReconsiderRegisterVo> getRegisterInfo(@RequestBody @Validated CaseProsecutionIdDto idDto) {
        CaseReconsiderRegisterVo registerInfo = caseReconsiderService.getRegisterInfo(idDto);
        return Result.success(Constant.STRING_GET_SUCCESS, registerInfo);
    }

    /**
     * 删除复议信息
     *
     * @param idDto 请求对象
     * @return 返回对象
     * @author lilihao
     * @date 2022/12/2 20:39
     */
    @PostMapping("/delInfo")
    @ApiOperation(value = "【V1.9.3】描述：删除复议信息", httpMethod = "POST")
    public Result delInfo(@RequestBody @Validated CaseProsecutionIdDto idDto) {
        caseReconsiderService.delInfo(idDto);
        return Result.success(Constant.STRING_SUCCESS_CH);
    }

    /**
     * 保存复议结果信息
     *
     * @param saveDto 请求对象
     * @return 返回对象
     * @author lilihao
     * @date 2022/12/8 20:39
     */
    @PostMapping("/saveResultInfo")
    @ApiOperation(value = "【V1.9.3】描述：保存复议结果信息", httpMethod = "POST")
    public Result saveResultInfo(@RequestBody @Validated CaseReconsiderResultSaveDto saveDto) {
        caseReconsiderService.saveResultInfo(saveDto);
        return Result.success(Constant.STRING_SAVE_SUCCESS);
    }

    /**
     * 获取案件复议详情
     *
     * @param idDto 请求对象
     * @return 案件诉讼详情
     * @author lilihao
     * @date 2022/12/2 20:39
     */
    @PostMapping("/getDetail")
    @ApiOperation(value = "【V1.9.3】描述：获取案件复议详情", httpMethod = "POST")
    public Result<Dict> getDetail(@RequestBody @Validated CaseProsecutionIdDto idDto) {
        Dict detail = caseReconsiderService.getDetail(idDto);
        return Result.success(Constant.STRING_GET_SUCCESS, detail);
    }

}